With the increasing size of software code, correctness verification is often conducted incrementally focusing on a few critical parts of the code in each test run. For example, modern kernel code for a computing device usually includes a large portion of code handling a variety of code branches. Usually, a kernel test may target one or two code branches without regard to other parts of the system that are of no interest in the current testing, or those handling rarely occurred boundary conditions, such as when a hard drive returns a wrong bit, when a network is broken, or other unusual error conditions. However, most existing code coverage tools attempt to cover every portion of target software, for example, to report a percentage of overall code covered in the testing. Therefore, comprehensive software test using such tools could waste disproportionate system and engineering resources on uninterested or uncritical software code.
Furthermore, to monitor each instruction execution on target software, existing code coverage tools usually require more functionalities than what standard compilers would offer. Such requirement, however, adds more complexity to software development environment. In addition, an executable built for existing code coverage tools tends to include significant amount of overhead code, resulting in a code size much larger than a corresponding executable built for release using standard compilers. Moreover, even if an existing code coverage tool, which is designed to cover the entire body of software to be tested, allows manual removal of selected portions of software code from coverage analysis, it can be cumbersome, laborious, or practically impossible to turn off coverage analysis of a large portion of source code when, for example, the source code files includes millions of code lines.
Therefore, traditional code coverage tools do not provide a simple and efficient mechanism for selective code coverage analysis.